/*
 * Copyright (c) 2020-2021, SERI Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2023-12-23     Lyons        first version
 */

#ifndef __GPIO_H__
#define __GPIO_H__

#include "__def.h"

typedef struct
{
    __IO uint32_t           cr;
    __IO uint32_t           in;
    __IO uint32_t           out;
         uint32_t           rsvd;
    __O  uint32_t           obit[16];
} GPIO_Type;

#define GPIO_BASE           (0x40000000)

#define GPIO1               ((GPIO_Type*)(GPIO_BASE))

#define POut(n,v)           do { \
                                GPIO1->obit[n] = v; \
                            } while (0);

#define LCD_BK_OFF          POut(3,0)
#define LCD_BK_ON           POut(3,1)

#define LCD_CS0_EN          POut(5,0)
#define LCD_CS0_DIS         POut(5,1)

#define LCD_RST_L           POut(7,0)
#define LCD_RST_H           POut(7,1)

#define LCD_DC_L            POut(8,0)
#define LCD_DC_H            POut(8,1)

#define LCD_SCL_L           POut(9,0)
#define LCD_SCL_H           POut(9,1)

#define LCD_SDA_L           POut(11,0)
#define LCD_SDA_H           POut(11,1)

#endif //#ifndef __UART_H__